Skip to content

Conversation

@haseebmalik18
Copy link
Contributor

@haseebmalik18 haseebmalik18 commented Dec 23, 2025

Add E2E tests for DAG audit log functionality

This PR implements comprehensive end-to-end tests for the DAG audit log feature to ensure proper functionality of the Events tab.

Changes

New Files

  • airflow-core/src/airflow/ui/tests/e2e/pages/EventsPage.ts - Page Object Model for the Events/audit log page
  • airflow-core/src/airflow/ui/tests/e2e/specs/dag-audit-log.spec.ts - E2E test specifications

Test Coverage

The implementation includes 5 test scenarios covering:

  1. Navigation and Table Visibility - Verifies users can navigate to the audit log tab and the table renders correctly
  2. Column Verification - Ensures all expected columns (When, Event, User, Extra) are displayed and DAG ID column is hidden in DAG-specific context
  3. Data Validation - Validates that audit log entries contain valid non-empty data
  4. Pagination - Tests navigation between pages and verifies content changes appropriately
  5. Sorting - Validates column header sorting functionality

closes: #59684

@boring-cyborg
Copy link

boring-cyborg bot commented Dec 23, 2025

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label Dec 23, 2025
@vatsrahul1001
Copy link
Contributor

@haseebmalik18 can you look at failures?

@haseebmalik18
Copy link
Contributor Author

Yes, I've taken a look I understand what the issue is I will have it in a day or two

@haseebmalik18
Copy link
Contributor Author

@vatsrahul1001 Just made the fixes. Should be good now.

@vatsrahul1001
Copy link
Contributor

@haseebmalik18 can you look at review comments?

@haseebmalik18
Copy link
Contributor Author

haseebmalik18 commented Jan 5, 2026

@vatsrahul1001 The E2E test for audit log pagination currently creates 4 events via 3 DAG triggers, but the UI config sets page_size: 15, so pagination won't trigger. To properly test pagination, we'd need 16+ events, which would require ~14+ DAG triggers which would be quite slow. What would you say is the recommended approach for generating event logs to generate pagination direct DB inserts, lower page_size config for tests, or another method?

@vatsrahul1001
Copy link
Contributor

vatsrahul1001 commented Jan 6, 2026

@haseebmalik18 Thanks for working on this! Few things to address:

  1. Boolean return methods - Methods like isAuditLogTableVisible() that catch errors and return false make debugging hard. Use Playwright assertions directly instead.

  2. Data validation - The current check just verifies "something exists". Better to verify actual content - event types (dag_triggered, created, etc.) and date formats.

  3. Sorting - Currently only checks that order changed, not that it's sorted correctly. Verify the actual sort direction.

  4. DagsPage changes - Why was waitForDagList() removed? Seems unrelated to audit log tests. Please revert or explain.

  5. Pagination - You can use the limit URL param to force smaller page size:

    /dags/{dagId}/events?offset=0&limit=3

    This way 4 events will trigger pagination (3 on page 1, 1 on page 2). Just update navigateToAuditLog to accept an optional limit parameter.

Let me know if you have questions!

@haseebmalik18
Copy link
Contributor Author

@vatsrahul1001 Made all the changes

@vatsrahul1001
Copy link
Contributor

@haseebmalik18 I see chrome test are flaky. It passed on retry. Can you look into this?

@haseebmalik18
Copy link
Contributor Author

@vatsrahul1001 Made the fix

@haseebmalik18
Copy link
Contributor Author

@vatsrahul1001 The chrome test is passing now. That failed test looks like it's from a different test suite, is that unrelated to our UI testing?

@vatsrahul1001
Copy link
Contributor

vatsrahul1001 commented Jan 9, 2026

@vatsrahul1001 The chrome test is passing now. That failed test looks like it's from a different test suite, is that unrelated to our UI testing?

@haseebmalik18 PR looking in good shape. Nice work!. A few minor comments for the test case rename.

I have re-run tests

@haseebmalik18
Copy link
Contributor Author

@vatsrahul1001 Made the test case rename changes. Also I was wondering since I made a bunch of commits will it auto squash into one commit?

@haseebmalik18
Copy link
Contributor Author

@vatsrahul1001 Made the changes

@vatsrahul1001 vatsrahul1001 merged commit a1872e1 into apache:main Jan 13, 2026
77 checks passed
@boring-cyborg
Copy link

boring-cyborg bot commented Jan 13, 2026

Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions.

Sahil-Shadwal added a commit to Sahil-Shadwal/airflow that referenced this pull request Jan 15, 2026
… PR pattern

- Remove LoginPage import and all login-related code
- Tests now receive authenticated page from Playwright's global storageState
- Initialize DagsPage directly in each test function
- Matches pattern from successfully merged PRs: apache#59943, apache#59919, apache#59734
- Fixes CI failures across Chromium, Firefox, and WebKit

Addresses reviewer feedback from @vatsrahul1001
jason810496 pushed a commit to jason810496/airflow that referenced this pull request Jan 22, 2026
…59734)

Add E2E tests for DAG audit log functionality
Co-authored-by: Rahul Vats <43964496+vatsrahul1001@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI E2E Test || DAG-014: Verify DAG audit log

2 participants